<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org" xmlns="http://www.w3.org/1999/html"
      xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity5">
<head>
    <meta charset="utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1"/>
    <meta name="renderer" content="webkit"/>
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content=" no-cache">
    <meta http-equiv="expires" content="0">
    <meta name="keywords" th:content="${keywords ?: keywords}"/>
    <meta name="description" th:content="${site_description}"/>
    <link rel="shortcut icon" th:href="@{/user/img/favicon.png}"/>
    <link rel="apple-touch-icon" th:href="@{/user/img/apple-touch-icon.png}"/>
    <title>
        <th:block th:text="${title ?: '首页'}+' - '+${commons.site_option('site_title','菜鸟毕设')}"></th:block>
    </title>
    <link th:href="@{//www.layuicdn.com/layui-v2.5.4/css/layui.css}" rel="stylesheet" type="text/css"/>
    <link th:href="@{//cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css}" rel="stylesheet"
          type="text/css"/>
    <link th:href="@{//cdn.staticfile.org/highlight.js/9.9.0/styles/xcode.min.css}" rel="stylesheet"/>
    <link th:href="@{/user/css/style.min.css}" rel="stylesheet"/>
    <link th:href="@{/user/css/index.css}" rel="stylesheet"/>
    <script th:src="@{/user/js/jquery-1.8.3.min.js}"></script>
    <script th:src="@{/user/js/jquery.cookie.js}"></script>
    <script>
        console.log("寻求一起接任务的兄弟，一起挣点小钱。有意向的直接加我微信并备注，本人微信号：15086626250");
        var _hmt = _hmt || [];
        (function () {
            var hm = document.createElement("script");
            hm.src = "https://hm.baidu.com/hm.js?5ad598be02bded436eef827c93450ed2";
            var s = document.getElementsByTagName("script")[0];
            s.parentNode.insertBefore(hm, s);
        })();
    </script>
    <!--[if lt IE 9]>
    <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<body>
<header id="header" class="header" style="border-radius: 85px;">
    <div class="navbar-container">
        <a href="/index" class="navbar-logo">
            <img th:src="@{/user/img/logo.png}" alt="首页" style="border-radius: 30px;"/>
        </a>
        <div class="navbar-menu">
            <a id="question"
               th:class="'layui-btn layui-btn-radius layui-btn-'+${commons.rand_layui_class()} +' layui-btn-'+${commons.rand_layui_class_size()}"
               th:href="${commons.site_url('/question/1')}">问答</a><span class="layui-badge-dot"></span>
            <a th:class="'layui-btn layui-btn-radius layui-btn-'+${commons.rand_layui_class()} +' layui-btn-'+${commons.rand_layui_class_size()}"
               th:href="${commons.site_url('/graduate_category')}">毕设分类</a>
            <a th:class="'layui-btn layui-btn-radius layui-btn-'+${commons.rand_layui_class()} +' layui-btn-'+${commons.rand_layui_class_size()}"
               th:href="${commons.site_url('/archives')}">所有毕设</a>
            <a th:class="'layui-btn layui-btn-radius layui-btn-'+${commons.rand_layui_class()} +' layui-btn-'+${commons.rand_layui_class_size()}"
               th:href="${commons.site_url('/timeLine')}">时间线</a>
            <a th:class="'layui-btn layui-btn-radius layui-btn-'+${commons.rand_layui_class()} +' layui-btn-'+${commons.rand_layui_class_size()}"
               th:href="${commons.site_url('/learnCode')}">资源库</a>
            <a th:class="'layui-btn layui-btn-radius layui-btn-'+${commons.rand_layui_class()} +' layui-btn-'+${commons.rand_layui_class_size()}"
               th:href="${commons.site_url('/links')}">友链</a>
            <a th:class="'layui-btn layui-btn-radius layui-btn-'+${commons.rand_layui_class()} +' layui-btn-'+${commons.rand_layui_class_size()}"
               th:href="${commons.site_url('/about')}">关于</a>
            <a id="orderQuery"
               th:class="'layui-btn layui-btn-radius layui-btn-'+${commons.rand_layui_class()} +' layui-btn-'+${commons.rand_layui_class_size()}"
               href="javascript:;">订单查询</a>
        </div>
        <!--如果未登录-->
        <div sec:authorize="!isAuthenticated()"
             style="position: fixed;right: 0px;top: 0px;height: 80px;line-height: 80px;overflow: hidden;vertical-align: center;">
            <a class="layui-btn layui-btn-primary layui-btn-sm layui-btn-radius" id="tologin" role="button"
               style="margin-top: 20px;">
                <svg class="bi bi-person-fill" width="1em" height="1em" viewBox="0 0 16 16" fill="currentColor"
                     xmlns="http://www.w3.org/2000/svg">
                    <path fill-rule="evenodd"
                          d="M3 14s-1 0-1-1 1-4 6-4 6 3 6 4-1 1-1 1H3zm5-6a3 3 0 1 0 0-6 3 3 0 0 0 0 6z"/>
                </svg>
                登录
            </a>
        </div>
        <!--如果已登录-->
        <div sec:authorize="isAuthenticated()" style="position: fixed;right: 40px;top: 5px;">
            <ul class="layui-nav" style="background-color: transparent;">
                <li class="layui-nav-item">
                    <a href="javascript:;">
                        <img th:src="@{${session.loginUser.getAvatar()}}" class="layui-nav-img">
                        <span sec:authentication="name"></span>
                    </a>
                    <dl class="layui-nav-child">
                        <dd><a href="javascript:;">修改信息</a></dd>
                        <dd><a href="javascript:;">安全管理</a></dd>
                        <dd><a th:href="@{/logout}">退了</a></dd>
                    </dl>
                </li>
            </ul>
        </div>

        <div class="navbar-search" onclick="">
            <span class="icon-search"></span>
            <form role="search" onsubmit="return false;">
                <span class="search-box">
                    <input type="text" id="search-inp" class="input" placeholder="搜索...............回车直达" maxlength="30"
                           autocomplete="off"/>
                </span>
            </form>
        </div>
    </div>
</header>
<article class="main-content post-page" itemscope="" itemtype="http://schema.org/Article">
    <div class="post-header">
        <h1 class="post-title" itemprop="name headline">
            <a th:href="${commons.permalink(article)}" th:text="${article.title}" data-no-instant=""></a>
        </h1>
        <div class="post-data">
            <time th:datetime="${commons.fmtdate(article.created)}" itemprop="datePublished"
                  th:text="'发布于 '+ ${commons.fmtdate(article.created)}"></time>
            /
            <th:block th:utext="${commons.show_categories(article.categories)}"/>
            / <a href="#comments" th:text="${article.commentsNum ?: 0}+' 条评论'"></a> /
            <th:block th:text="${article.hits}"/>
            浏览
        </div>
    </div>
    <div id="post-content" class="post-content" itemprop="articleBody">
        <input id="price" type="hidden" th:value="${article.price}"/>
        <p class="post-tags" th:utext="${commons.show_tags(article.tags)}"></p>
        <th:block th:utext="${commons.article(article.content)}"/>
        <hr/>
        <p>
            <span style="text-shadow:0 0 5px #e0ea33,0 0 15px #e0ea33,0 0 25px #e0ea33;font-size:20px;">本系统需要付费（如需咨询定制或其他服务添加站长q1343691474）</span>
        </p>
        <p>
            <button class="layui-btn layui-btn-radius layui-btn-lg layui-btn-warm" onclick="submit()" id="submit">
                获取源码和相关文档
            </button>
        </p>
        <p class="words" style="margin-bottom: 20px; text-align: center;font-size: 22px;font-weight: 600;">
            做一件事最好的时间是<span class="layui-badge">昨天</span>其次是 <span class="layui-badge layui-bg-blue" th:text="${#dates.format(#dates.createNow(),'yyyy年MM月dd日 HH:mm:ss')}"></span>
        <p class="words" style="text-align: right;">---来自菜鸟毕设站长的肺腑之言</p>
        </p>
        <p class="post-info">
            最后编辑时间为:
            <th:block th:text="${commons.fmtdate(article.modified, 'yyyy/MM/dd HH:mm')}"/>
        </p>
        <p class="words" style="margin-bottom: 20px; text-align: left;font-size: 22px;font-weight: 600;color: #2fb6e6;">
            你可以永远相信菜鸟毕设
        <p class="words" style="text-align: right;">---鲁迅</p>
        </p>
    </div>
</article>
<!--<div th:replace="themes/default/comments::comments"></div>-->
<div th:replace="themes/default/footer::footer"></div>
<div th:replace="comm/enlarge::enlarge"></div>
<script src="https://www.layuicdn.com/layui-v2.5.4/layui.all.js" charset="utf-8"></script>
<script th:inline="javascript">
    // 判断是否支付宝内打开
    function isAlipay() {
        var ua = window.navigator.userAgent.toLowerCase();
        if (ua.indexOf("alipay") >= 0) {
            return 1;
        }
        return 0;
    }

    /*此处不用表单提交，表单提交存在问题*/
    function submit() {
        var price = $("#price").val();
        $.cookie('picName', price, {path: '/recharge'});
        $.cookie('money', price, {path: '/recharge'});
        //设置二维码失效时长120s
        $.cookie('time', 120, {path: '/recharge'});
        $.cookie('title', [[${article.title}]], {path: '/recharge'});
        $.ajax({
            url: "/alipay/precreate",
            type: "POST",
            data: {
                "rechargeMoney": price,
                "payType": 1,
                "cid": [[${article.cid}]]
            },
            async: false,
            success: function (data) {
                if (data.code == '0') {
                    // 存入id和qrCode
                    $.cookie('payId', data.data.id, {path: '/recharge'});
                    $.cookie('qrCode', data.data.qrCode, {path: '/recharge'});
                    $("#submit").removeAttr("disabled");
                    $("#submit").val("立刻支付");
                    if (isAlipay()) {
                        window.location.href = data.data.qrCode;
                    } else {
                        layer.confirm('亲，本项目可能需要付费购买，是否继续？', {
                            btn: ['确认继续', '暂不考虑']
                        }, function () {
                            layer.msg('正在生成订单中', {
                                icon: 16
                                , shade: 0.5
                                , time: 3000
                                , end: function (index) {
                                    window.location.href = "/recharge/dmf";
                                }
                            });
                        });


                    }
                } else {
                    $("#submit").removeAttr("disabled");
                    $("#submit").val("立刻支付");
                    layer.msg(data.msg, {icon: 5});
                }
            },
            error: function (XMLHttpRequest) {
                if (XMLHttpRequest.status != 200) {
                    $("#submit").removeAttr("disabled");
                    $("#submit").val("立刻支付");
                    alert('出错啦! 错误码:' + XMLHttpRequest.status);
                }
            }
        });
    }
</script>
<a class="to-top" style="z-index: 999;text-decoration: none;">
    <i class="layui-icon layui-icon-top" style="font-size: 60px; background-color: #09bdb4;border-radius: 50%;"></i>
</a>
<script th:src="@{/user/js/toTop.js}"></script>
<div th:replace="comm/bg3::bg3"></div>
<script>
    $(document).ready(function () {
            //第一次进入页面刷新一次，仅一次
            if (location.href.indexOf("#") == -1) {
                //在当前页面地址加入"#"，使下次不再进入此判断
                location.href = location.href + "#";
                location.reload();
            }
        }
    )

    $("#tologin").click(function () {
        window.location.href = '/toLogin';
    })

    $("#orderQuery").click(function () {
        $("#indexCommon").css("display", "none");
        layer.prompt({
            title: '请输入您购买的毕设对应的订单编号，并确认', formType: 0, end: function (index, layero) {
                $("#indexCommon").css("display", "block");
            }
        }, function (orderno, index) {
            if (orderno.trim() == "") {
                layer.msg("请输入订单号！", {icon: 5});
            }
            $.ajax({
                url: "/alipay/queryOrderInfo",
                type: "GET",
                data: {
                    "orderNo": orderno
                },
                async: false,
                success: function (data) {
                    debugger;
                    if (data.code === 0) {
                        layer.close(index);
                        var remark = data.orderInfo.remark;
                        layer.open({
                            type: 1
                            ,
                            title: false //不显示标题栏
                            ,
                            closeBtn: true
                            ,
                            area: '500px;'
                            ,
                            shade: 0.5
                            ,
                            id: 'LAY_layuipro' //设定一个id，防止重复弹出
                            ,
                            resize: true
                            ,
                            moveType: 1 //拖拽模式，0或者1
                            ,
                            content: '<div style="padding: 50px; line-height: 22px; background-color: #393D49; color: #fff; font-weight: 300;">' + remark + '</div>'
                        });
                    } else {
                        layer.msg(data.msg, {icon: 5})
                    }
                },
                error: function (XMLHttpRequest) {
                }
            });

        });
    })
</script>
</body>
</html>